﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SharpMap.Control;

namespace AHP2
{
    public partial class MapPane : WeifenLuo.WinFormsUI.Docking.DockContent
    {
        private ToolStripStatusLabel _map_coord_label = null;
        public MapPane()
        {
            InitializeComponent();
        }

        private void MapPane_Load(object sender, EventArgs e)
        {

        }

        public AxSharpMapControl MapControl
        {
            get { return this.axSharpMapControl1;   }
        }

        #region Map Coordinate Label
        public ToolStripStatusLabel CoordinateLabel
        {
            set { this._map_coord_label = value; }
        }
        #endregion

        private void axSharpMapControl1_MouseMove(object sender, MouseEventArgs e)
        {
            if (_map_coord_label != null)
            {
                if (this.axSharpMapControl1.Map.Layers.Count > 0)
                {
                    SharpMap.Geometries.Point xy =  this.axSharpMapControl1.Map.ImageToWorld(new Point(e.X, e.Y));
                    _map_coord_label.Text = "X=" + xy.X.ToString() + ",Y=" + xy.Y.ToString();
                }
            }
        }
    }
}
